<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>测试</title>
    <script type="text/javascript" src="./js/jquery.js"></script>
    <script type="text/javascript" src="./js/beautify.js"></script>
    <style>
	button.submit {
		width: 100%;
		padding: 10px 0;
		cursor: pointer;
		margin: 0;
	}
	</style>
</head>

<body>
	<textarea id="source" rows="30" cols="189"></textarea>
	<button class="submit"><strong>Beautify JavaScript</strong></button>
</body>
</html>
<script type="text/javascript">
var default_text = "// This is just a sample script. Paste your real code (javascript or HTML) here.\n\nif ('this_is'==/an_example/){of_beautifier();}else{var a=b?(c%d):e[f];}";
$('#source').val(default_text).bind('click focus', function () {
	if ($(this).val() == default_text) {
		$(this).val('');
	}
}).bind('blur', function () {
	if (!$(this).val()) {
		$(this).val(default_text);
	}
});
function beautify() {
	var output = js_beautify($("#source").val());
	$("#source").val(output);
}
$('.submit').click(beautify);
</script>
